import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import stockRouter from './components/stock'



const routes: Array<RouteRecordRaw> = [
    ...stockRouter,
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },{
      path:'/login',
      name:'login',
    component:()=>import('../views/Login.vue')
  },{
      path:'/',
      name:'layout',
      component:()=>import('../views/layout/Index.vue')
  },{
         path:'/stock',
         name:'stock',
         component:()=>import('../views/layout/Index.vue'),
        children:[
            {
                path:'product',
                name:'product',
                component:()=>import('../views/stock/Product.vue')
            }
        ]
    },{
         path:'/system',
        name:'system',
        component:()=>import('../views/layout/Index.vue'),
        children:[
            {
                path:'user',
                name:'user',
                component:()=>import('../views/system/User.vue')
            },{
                path:'role',
                name:'role',
                component:()=>import('../views/system/Role.vue')
            }
        ]
    }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
